﻿<%@ Page Language="C#" %>

<%@ Import Namespace="wojilu" %>
<%@ Import Namespace="wojilu.View" %>
<%@ Import Namespace="wojilu.Apps.Qycms.Domain" %>
<%@ Import Namespace="wojilu.Apps.Qycms.Service" %>

<%var modelattrread = v.data("modelattrread") as Model_Att; %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<title>#{softtitle}</title>
<link href="#{path.css}ybb/css/baselist.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/all.css?v=#{cssVersion}" rel="stylesheet" type="text/css" />
<link href="#{path.css}ybb/css/formdiv.css?v=#{cssVersion}" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="#{path.js}ybb/js/jquery.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/form.js?v=#{jsVersion}"></script>
<script type="text/javascript" src="#{path.js}ybb/js/control.js?v=#{jsVersion}"></script>
<script type="text/javascript">

	var resizewindow= null;

	window.onresize = function(){
		var h = $(window).height();
		if(resizewindow!=h){
			sizewindow();
			resizewindow=h;
		}
	}

	function sizewindow(){
		var h = $(window).height();
		if(document.getElementById("mainbodybottonauto")){
			$('.managebottonadd').css({height:h-40});
		}
	}
	var modelmanage_js_attr_typename_empty  = "_{modelmanage_js_attr_typename_empty}";
	var modelmanage_js_attr_attrvalue_empty  = "_{modelmanage_js_attr_attrvalue_empty}";
	var modelmanage_js_attr_attrsize_empty  = "_{modelmanage_js_attr_attrsize_empty}";
	var modelmanage_js_attr_attrrow_empty  = "_{modelmanage_js_attr_attrrow_empty}";
	var modelmanage_js_attr_attrlenther_empty  = "_{modelmanage_js_attr_attrlenther_empty}";
	var modelmanage_js_attr_attrlenther_empty2  = "_{modelmanage_js_attr_attrlenther_empty2}";
	var modelmanage_js_attr_edit_ok = "_{modelmanage_js_attr_edit_ok}";
	var modelmanage_js_attr_edit_no = "_{modelmanage_js_attr_edit_no}";
	var iframename = "#{iframename}";
	$(document).ready(function(){
	    var h = '#{iframeheightwindow}';
		$('.managebottonadd').css({height:h-40});
		var options = {
			beforeSubmit: formverify,
			success:saveResponse
		}
		$('#modelattredit').submit(function() {
			$(this).ajaxSubmit(options);
			return false;
		});
	})

	function formverify(formData, jqForm, options) {
		var queryString = $.param(formData);
		var get=urlarray(queryString);
		if(get['typename']==""){
			document.modelattredit.typename.focus();
			alert(modelmanage_js_attr_typename_empty);
			return false;
		}
        <%if(modelattrread.lockin ==0){%>
		if(get['inputtype']=="select" || get['inputtype']=="radio" || get['inputtype']=="checkbox"){
			if(get['attrvalue']==""){
				document.modelattradd.attrvalue.focus();
				alert(modelmanage_js_attr_attrvalue_empty);
				return false;
			}
		}
		if(get['attrsize']!=""){
			if(get['attrsize'].match(/^[1-9]{1}[0-9]{0,2}$/ig)==null) {
				document.modelattredit.attrsize.focus();
				alert(modelmanage_js_attr_attrsize_empty);
				return false;
			}
		}
		if(get['attrrow']!=""){
			if(get['attrrow'].match(/^[1-9]{1}[0-9]{0,2}$/ig)==null) {
				document.modelattredit.attrrow.focus();
				alert(modelmanage_js_attr_attrrow_empty);
				return false;
			}
		}
		<%}%>
	    parent.windowsdig('Loading', 'iframe:#{load}', '400px', '180px', 'iframe', false);
	}
	function saveResponse(options){
		parent.closeifram();
		if (options=='true'){
			parent.frames[iframename].refresh('selectform','selectall','check_all');
			alert(modelmanage_js_attr_edit_ok);
		}else{
			alert(modelmanage_js_attr_edit_no+options);
		}
		parent.onaletdoc()
	}
</script>
</head>

<body>
<form name="modelattredit" id="modelattredit" method="post" action="#{ActionLink}">
<input type="hidden" name="inputclass" value="edit" />
<input type="hidden" name="mid" value="<%=modelattrread.mid %>" />
<input type="hidden" name="smid" value="#{mid}" />
<div id="mainbodybottonauto" class="managebottonadd">
	<div class="maindobycontent">
		<div class="suggestion">
			<span class="sugicon"><span class="strong colorgorning2">_{position_title}</span><span class="colorgorningage">_{modelmanage_attr_edit_mess} <u><%=modelattrread.typename %></u> （<%=modelattrread.attrname %>）</span></span>
		</div>
		<div class="manageeditdiv">
			<div class="maneditcontent">
				<table class="formtable">
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">_{modelmanage_attr_add_attrname}</td>
						<td width="85%" class="trtitle02"><span class="colorgreg"><%=modelattrread.attrname %></span></td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle011">_{modelmanage_attr_add_inputtype}</td>
						<td width="85%" class="trtitle02">
							<select name="inputtype2" id="inputtype" disabled>
                                <%var list = v.data("list") as List<FormType>; %>
								<%foreach (var row in list){ %>
								<option <%if(modelattrread.inputtype==row.Key){ %>selected <%} %>value="<%=row.Key %>"><%=row.Name %></option>
								<%} %>
							</select>
						</td>
					</tr>
					<tr class="trstyle3">
						<td width="15%" class="trtitle011">_{modelmanage_attr_add_typename}</td>
						<td width="85%" class="trtitle02"><input type="text" name="typename" size="80" maxlength="50" value="<%=modelattrread.typename %>" class="infoInput"/></td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01"></td>
						<td width="85%" class="trtitle02"><span class="cautiontitle">_{modelmanage_attr_add_typename_mess}</span></td>
					</tr>
					<tr class="trstyle3">
						<td width="15%" class="trtitle01">_{modelmanage_attr_add_typeremark}</td>
						<td width="85%" class="trtitle02"><input type="text" name="typeremark" size="80" maxlength="200" value="<%=modelattrread.typeremark %>" class="infoInput"/></td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01"></td>
						<td width="85%" class="trtitle02"><span class="cautiontitle">_{modelmanage_attr_add_typeremark_mess}</span></td>
					</tr>
					<tr class="trstyle3">
						<td width="15%" class="trtitle01">_{modelmanage_attr_add_attrvalue}</td>
						<td width="85%" class="trtitle02">
							<textarea name="attrvalue" cols="40" rows="5" style="width:99%;height:85px;"><%=modelattrread.attrvalue %></textarea>
						</td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01"></td>
						<td width="85%" class="trtitle02"><span class="cautiontitle">_{modelmanage_attr_add_attrvalue_mess}</span></td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">_{modelmanage_attr_add_isvalidate}</td>
						<td width="85%" class="trtitle02">
							<input type="radio" value="1" name="isvalidate"<%if(modelattrread.isvalidate==1){ %> checked="checked"<%} %> onclick="ondisplay('validatetextdiv,#validatetextdiv2','trstyle2 displaytrue')"/> _{open_botton_title}&nbsp;
							<input type="radio" value="0" name="isvalidate"<%if(modelattrread.isvalidate==0){ %> checked="checked"<%} %> onclick="ondisplay('validatetextdiv,#validatetextdiv2','trstyle2 displaynone')"/> _{close_botton_title}
							<span class="cautiontitle">_{modelmanage_attr_add_isvalidate_mess}</span>
						</td>
					</tr>
					<tr class="trstyle2<%if(modelattrread.isvalidate==0){ %> displaynone<%} %>" id="validatetextdiv">
						<td width="15%" class="trtitle011">_{modelmanage_attr_add_validatetext}</td>
						<td width="85%" class="trtitle02">
							<input type="text" name="validatetext" id="validatetext" size="40" value="<%=modelattrread.validatetext %>" maxlength="80" class="infoInput"/>
							<select name="validatetext_select" onchange="javascript:$('#validatetext').val(this.value)">
								<option value="">选择预定正则</option>
								<option value="/^[0-9.-]+$/">数字</option>
								<option value="/^[0-9-]+$/">整数</option>
								<option value="/^[a-z]+$/i">字母</option>
								<option value="/^[0-9a-z]+$/i">数字+字母</option>
								<option value="/^[\w\-\.]+@[\w\-\.]+(\.\w+)+$/">E-mail</option>
								<option value="/^[0-9]{5,20}$/">QQ</option>
								<option value="/^http:\/\//">超级链接</option>
								<option value="/^(1)[0-9]{10}$/">手机号码</option>
								<option value="/^[0-9-]{6,13}$/">电话号码</option>
								<option value="/^[0-9]{6}$/">邮政编码</option>
							</select>
						</td>
					</tr>
					<tr class="trstyle2<%if(modelattrread.isvalidate==0){ %> displaynone<%} %>" id="validatetextdiv2">
						<td width="15%" class="trtitle01"></td>
						<td width="85%" class="trtitle02"><span class="cautiontitle">_{modelmanage_attr_add_validatetext_mess}</span></td>
					</tr>
                    <%if(modelattrread.lockin ==0){ %>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">_{modelmanage_attr_add_attrsize}</td>
						<td width="85%" class="trtitle02"><input type="text" name="attrsize" size="6" maxlength="3"  value="<%=modelattrread.attrsize %>" class="infoInput"/> <span class="cautiontitle">_{modelmanage_attr_add_attrsize_mess}</span></td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">_{modelmanage_attr_add_attrrow}</td>
						<td width="85%" class="trtitle02"><input type="text" name="attrrow" size="6" maxlength="3" value="<%=modelattrread.attrrow %>" class="infoInput"/> <span class="cautiontitle">_{modelmanage_attr_add_attrrow_mess}</span></td>
					</tr>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">_{modelmanage_attr_issearch_validatetext}</td>
						<td width="85%" class="trtitle02">
							<input type="radio" value="1" name="issearch"<%if(modelattrread.issearch==1){ %> checked="checked"<%} %>/> _{open_botton_title}&nbsp;
							<input type="radio" value="0" name="issearch"<%if(modelattrread.issearch==0){ %> checked="checked"<%} %>/> _{close_botton_title}
							<span class="cautiontitle">_{modelmanage_attr_issearch_validatetext_mess}</span>
						</td>
					</tr>
					<%} %>
					<tr class="trstyle2">
						<td width="15%" class="trtitle01">_{modelmanage_attr_isclass_validatetext}</td>
						<td width="85%" class="trtitle02">
							<input type="radio" value="1" name="isclass"<%if(modelattrread.isclass==1){ %> checked="checked"<%} %>/> _{open_botton_title}&nbsp;
							<input type="radio" value="0" name="isclass"<%if(modelattrread.isclass==0){ %> checked="checked"<%} %>/> _{close_botton_title}
							<span class="cautiontitle">_{modelmanage_attr_isclass_validatetext_mess}</span>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</div>
</div>
<div id="downbotton">
	<div id="subbotton">
		<table border="0" width="100%">
			<tr>
				<td id="right"><input type="submit" id="submitbotton" name="Submit" value="_{botton_edit}" class="buttonface" /></td>
				<td id="left" class="padding-left5"><input type="button" name="cancel" onClick="javascript:parent.onaletdoc();" value="_{botton_edit_reset}" class="buttonface" /></td>
			</tr>
		</table>
	</div>
</div>
<input type="hidden" name="lockin" value="<%=modelattrread.lockin %>" />
<input type="hidden" name="inputtype" value="<%=modelattrread.inputtype %>" />
<input type="hidden" name="attrname" value="<%=modelattrread.attrname %>" />
<%if(modelattrread.lockin==1){ %>
<input type="hidden" name="attrsize" value="<%=modelattrread.attrsize %>" />
<input type="hidden" name="attrrow" value="<%=modelattrread.attrrow %>" />
<%} %>
</form>
</body>
</html>